<%@ page contentType="text/html;charset=utf-8" language="java"%>
<!DOCTYPE html>
<%@include file="./common/base.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="有而，youoor，社交名片，聚合社交，兴趣交友，简约社交，匿名社交.">
<meta name="description" content="有而（youoor）国内最便捷的创建社交名片平台，它可以聚合你的社交网络身份：微博、微信、SNS、相册、网店、个人网站、QQ、Email等等，创建专属于你自己的网络社交名片，创建你最有范儿的社交名片，表现社交网站中最好的你。">
<title>有而网-聚合你的社交身份</title>
<link rel="icon" href="../favicon.ico" mce_href="../favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="../favicon.ico" mce_href="../favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/common.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
<script type="text/javascript" src="js/js.js"></script>
</head>

<body>
<div class="outer-wrapper-card" id="outer-wrapper-card-id">
	<!--login box -->
	<div class="outer-wrapper-register">
    	<!--logo -->
        <div class="logo">
        	<a href="#" class="logo-img"></a>
            
        </div><!-- logo end-->
        <div style="font-size: 18px;color: #fff;text-align: center;margin-top: 10px;margin-bottom: 20px;">一分钟创建你最有范儿的社交名片</div>
        <form class="register" id="register_bx">
        	<p class="form-register"><input type="text" value="" id="username" name="username" placeholder="用户名"/><span class="error-tip" id="usernameTip"></span></p>
            <p class="form-register"><input type="email" value="" id="email" name="email" placeholder="邮箱"/><span class="error-tip" id="emailTip"></span></p>
            <p class="form-register"><input type="password" value=""  id="psw" name="psw" placeholder="密码"/><span class="error-tip" id="pswTip"></span></p>
            <p class="form-register"><input type="password" value="" id="psw_com" name="psw_com" placeholder="确认密码" onkeydown=registerKeyDown() /><span class="error-tip" id="confirmTip"></span></p>
            <p class="form-register  form-submit"><input type="button" value="注册" id="submit1" name="submit1" onclick="register()"/></p>
            <!--<a class="form-register form-text" onclick="toGuang()">随便逛逛？</a>-->
        </form>
        <!--Login -->
    	<form class="register" style="display:none;" id="login_bx">
        	<p class="form-register"><input type="text" value="" id="usernameLogin" placeholder="用户名" name="usernameLogin"/><span class="error-tip" id="loginerrorTip1"></span></p>
			<p class="form-register"><input type="password" value=""  id="pswLogin" name="psw" placeholder="密码" onkeydown=loginKeyDown() /><span class="error-tip" id="loginerrorTip2"></span></p>
            <p class="login-member"><input type="checkbox" id="memberpsw" checked="checked" name="memberpsw"/><label for="memberpsw">下次自动登陆</label></p>
            <p class="form-register  form-submit"><input type="button" value="登陆" id="login1" name="login1"  onclick="login()"/></p>
            <!--  <a class="form-register form-text" onclick="toGuang()">随便逛逛？</a>-->
    	</form>
		<!--Login end -->
        
    </div><!--login box end -->
    
   
    <!--login btn -->
    <button id="login_btn_bt"  class="login_btn">登陆</button>
    <!--login btn end -->
    <!--footer -->
   <div class="con-ft con-ft-ab">
    	2014 All Rights Reserved 有而工作室 京ICP备12032973号-3
    </div>
    <!--footer end -->
</div>
<script type="text/javascript">
$(function(){
	var k=GetRandomNum(0,7)
	$("#outer-wrapper-card-id").css("background-image","url("+imgDomain+"bg_"+k+".jpg)");//"+imgDomain+msg.cardInfo.userCard.background+"
});
function loginKeyDown() {
	if(event.keyCode == 13){
		login();
	}
}
function registerKeyDown() {
	if(event.keyCode == 13){
		register();
	}
}

function toGuang() {
	window.location.href='${path}/recommend.jsp';
}


//login
function register(){
	  var name  = $("#username").val();
	  var pwd = $("#psw").val();
	  var psw_com = $("#psw_com").val();
	  var email = $("#email").val();
	  if(name==""){
		  alert("用户名不能为空");return;
	  }
	  if(pwd==""){
		  alert("密码不能为空");return;
	  }
	  if(psw_com!=pwd){
		  alert("确认密码不一致");return;
	  }
	  if(email==""){
		  alert("邮箱不能为空");return;
	  }
	  var objp={};
	  objp.userName=name;
	  objp.password =pwd;
	  objp.email =email;
	   $.ajax({
			  url: '${path}/core/register',
			  type: 'POST',
			  timeout: 30000,
			  cache : false,
		      data :objp,
		      async: false,
			  success:function(msg){
				    window.location.href='${path}/edit.jsp';
			   },
			  failure:function(msg){
			   		alert("注册失败!");
			   		
			   },
			   error:function(msg){
				   alert(eval('('+msg.responseText+')').error_text); 
			   }
		});
}

//login
function login(){
	  var name  = $("#usernameLogin").val();
	  var pwd = $("#pswLogin").val();
	  if(name==""){
		  alert("用户名不能为空");return;
	  }
	  if(pwd==""){
		  alert("密码不能为空");return;
	  }
	  var objp={};
	  objp.userName=name;
	  objp.password =pwd;
	   $.ajax({
			  url: '${path}/core/login',
			  type: 'POST',
			  timeout: 30000,
			  cache : false,
		      data :objp,
		      async: false,
			  success:function(msg){
				  if (msg.result == 0) {
					  window.location.href='${path}/edit.jsp';
				  }else {
					 // window.location.href='http://localhost:8080/youoor/home.jsp';
					  window.location.href='${path}/discover.jsp';
				  }
				  
			   },
			   failure:function(msg){
				   alert(eval('('+msg.responseText+')').error_text);
			   		
			   },
			   error:function(msg){
				   alert(eval('('+msg.responseText+')').error_text); 
			   }
		});
}
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?a6c251bdc8002cd1589e4a9936937cb9";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>

</body>
</html>
